package hot100;

import java.util.Scanner;
import java.util.ArrayList;

public class Main {
    public static void main(String args[]) {
        Scanner in = new Scanner(System.in);

        int n = in.nextInt();
        ArrayList<Integer> arr = new ArrayList<Integer>();
        for (int i = 0; i < n; i++) {
            arr.add(in.nextInt());
        }
        int x = in.nextInt();
        int y = in.nextInt();
        int index1 = arr.indexOf(x);
        int index2 = arr.indexOf(y);
        if (index1 - index2 == 1 || index1 - index2 == -1) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
        in.close();
    }
}
